package com.ddl.common.exception;


import com.ddl.common.enums.ErrorCode;

/**
 *@author created by dudianbo
 *@date   2018年4月18日 上午10:00:21
 *
 **/
public class ResultModel {
    private Message message=new Message();
    private Object data;
    public Message getMessage() {
        return message;
    }
    public void setMessage(Message message) {
        this.message = message;
    }
    
    public Object getData() {
        return data;
    }
    public void setData(Object data) {
            this.data = data;
    }
    public void setCode(String code){
        this.message.setCode(code);
    }
    public void setMsg(String msg){
        this.message.setMsg(msg);
    }
    public static ResultModel getSuccessInstance(){
        ResultModel resultModel=new ResultModel();
        resultModel.setCode(ErrorCode.RETURN_SUCCESS_0000.getCode());
        resultModel.setMsg(ErrorCode.RETURN_SUCCESS_0000.getMessage());
        return resultModel;
    }
    public static ResultModel getErrorInstance(String msg) {
        ResultModel resultModel = new ResultModel();
        resultModel.setCode("400");
        resultModel.setMsg(msg);
        return resultModel;
    }
    
}
